package com.winer.mapper;

import com.winer.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface UserMapper {

    @Select("select * from tb_user where phone = #{phone} and role = #{role}")
    User queryByPhoneAndRole(@Param("phone")String phone, @Param("role")String role);

    @Insert("insert into tb_user(phone,role,user_id,create_time) values (#{phone},#{role},#{userID},#{now})")
    void saveUser(@Param("phone")String phone, @Param("role") String role,
                  @Param("userID") String userID,@Param("now") LocalDateTime now);
}
